package org.tinygroup.uiml.config;

import org.apache.commons.lang.StringUtils;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

/**
 * Created by luoguo on 2014/6/30.
 */
@XStreamAlias("property")
public final class Property {
    /**
     * 所属平台
     */
	@XStreamAsAttribute
    String platform;
    /**
     * 名字
     */
	@XStreamAsAttribute
    private String name;
    /**
     * 标题
     */
	@XStreamAsAttribute
    private String title;
	
    /**
     * 值
     */
	@XStreamAsAttribute
    private String value;
    /**
     * 所属分类
     */
	@XStreamAsAttribute
    private String category;

    public Property() {

    }

    public String getPlatform() {
        return platform;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public Property(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Property) {
			if (StringUtils.equals(((Property) obj).getPlatform(), getPlatform()) 
					&& StringUtils.equals(((Property) obj).getName(), getName())) {
				return true;
			}
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return getPlatform().hashCode() + getName().hashCode();
	}
	
}
